package com.xbongbong.saas.enums.product;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.ScreenTypeEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import com.xbongbong.saas.enums.business.ProductEnum;
import lombok.Getter;

@Getter
public enum PriceSetEnum {

    // 价目表名称
    NAME("name", "enum.priceSet.attrName.name", "name", FieldTypeEnum.TEXT.getType(), 100, 1, 1, 1),
    // 优先级
    PRIORITY("priority", "enum.priceSet.attrName.priority", "priority", FieldTypeEnum.NUM.getType(), 100, 1, 0, 1),
    // 生效时间
    START_TIME("startTime", "enum.priceSet.attrName.start_time", "startTime", FieldTypeEnum.NUM.getType(), 100, 1, 0, 1),
    // 结束时间
    END_TIME("endTime", "enum.priceSet.attrName.end_time", "END_TIME", FieldTypeEnum.NUM.getType(), 100, 1, 0, 1),
    // 备注
    MEMO("memo", "enum.priceSet.attrName.memo", "memo", FieldTypeEnum.TEXTAREA.getType(), 100, 1, 0, 1),
    // 价目对象
    ADAPTER_TYPE("adapterType", "enum.priceSet.attrName.adapter_type", "adapterType", FieldTypeEnum.COMBO.getType(), 100, 1, 1, 1),
    // 适用表单
    SCOPE("scope", "enum.priceSet.attrName.scope", "scope", FieldTypeEnum.TEXT.getType(), 100, 1, 1, 1),
    // 关联产品
    PRODUCT("array_1", "enum.priceSet.attrName.product", "products", FieldTypeEnum.SUB_FORM.getType(), 1, 1, 0, 1),
    // 价目对象
    //ASSOCIATED_FORM_TEMPLATES("associatedFormTemplates", "enum.priceSet.attrName.associatedFormTemplates", "associatedFormTemplates", FieldTypeEnum.TEXTAREA.getType(), 100, 0, 0, 0),

    ;

    /**
     * 英文名称
     */
    private final String attr;
    /**
     * 中文名称
     */
    private final String attrName;
    /**
     * 对应saas中的attr
     */
    private final String saasAttr;
    /**
     * 字段类型，详见
     *
     * @see com.xbongbong.paas.enums.FieldTypeEnum
     */
    private final Integer fieldType;

    /**
     * 字段在模板设计界面的排序
     * 建议不要用连续的数字，可以用等差数列，以防以后在两个字段之间加入新字段
     */
    private final Integer sort;
    /**
     * 字段在各个界面是否可见(启用)
     * 1：可见
     * 0：不可见
     * 注：字段在具体页面的可见性需要用属性和showType联合判断，在visible=1的情况下判断showType
     */
    private final Integer visible;
    /**
     * 字段是否必填
     * 1：必填
     * 0：不必填
     */
    private final Integer required;
    /**
     * 是否允许编辑 1：允许 0：不允许
     */
    private final Integer editable;

    PriceSetEnum(String attr, String attrName, String saasAttr, Integer fieldType, Integer sort, Integer visible, Integer required, Integer editable) {
        this.attr = attr;
        this.attrName = attrName;
        this.saasAttr = saasAttr;
        this.fieldType = fieldType;
        this.sort = sort;
        this.visible = visible;
        this.required = required;
        this.editable = editable;
    }

    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }
}
